package com.ivi.car.module.maintain.view.adapter;

import android.graphics.Color;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ivi.car.R;
import com.ivi.car.bean.MaintainCarPlanBean;

import java.util.List;

/**
 * Created by zhaolong.han on 2018/3/8.
 */

public class MaintainCarPlanAdapter
    extends BaseMultiItemQuickAdapter<MaintainCarPlanBean, BaseViewHolder> {
  /**
   * Same as QuickAdapter#QuickAdapter(Context,int) but with
   * some initialization data.
   *
   * @param data A new list is created out of this one to avoid mutable list
   */
  public MaintainCarPlanAdapter(List<MaintainCarPlanBean> data) {
    super(data);
    addItemType(MaintainCarPlanBean.ITEM1, R.layout.maintain_plan_item_1);
    addItemType(MaintainCarPlanBean.ITEM2, R.layout.maintain_plan_item_2);
  }

  @Override
  protected void convert(BaseViewHolder helper, MaintainCarPlanBean item) {
    switch (helper.getItemViewType()) {
      case MaintainCarPlanBean.ITEM1:

        break;
      case MaintainCarPlanBean.ITEM2:
        TextView textView = helper.getView(R.id.tv_line_top);
        if (helper.getPosition() == 0) {
          textView.setBackgroundColor(Color.parseColor("#1f2430"));
        } else if (helper.getPosition() == 3) {
          textView.setBackgroundColor(Color.parseColor("#1f2430"));
        }
        break;
      default:
        break;
    }
  }
}
